package com.xxl.sso.server.service;

import com.fasterxml.jackson.databind.exc.InvalidFormatException;
import com.xxl.sso.server.core.dto.UserOutDTO;
import com.xxl.sso.server.core.entity.AppEntity;
import com.xxl.sso.server.core.entity.BaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Api(tags = "会员服务接口")
public interface MemberService {
    /**
     * 根据手机号码查询是否已经存在,如果存在返回当前用户信息
     *
     * @param mobile
     * @return
     */
    @ApiOperation(value = "根据手机号码查询是否已经存在")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "mobile", dataType = "String", required = true, value = "用户手机号码"), })
    @PostMapping("/existMobile")
    BaseResponse<UserOutDTO> existMobile(@RequestParam("mobile") String mobile);

    /**
     * 根据token查询用户信息
     *
     * @param token
     * @return
     */
    @GetMapping("/getUserInfo")
    @ApiOperation(value = "/getUserInfo")
    BaseResponse<UserOutDTO> getInfo(@RequestParam("token") String token);

    /**
     * 调用微信服务接口
     * @return
     */
    @GetMapping("/memberInvokWeixin")
    public AppEntity memberInvokWeixin();

    /**
     * 下载文档
     */
    @GetMapping("/export/{docName}")
    public String exportMap(@RequestParam String docName, HttpServletResponse response) throws IOException, InvalidFormatException, InvalidFormatException;

    /**
     * 上传资料
     */
    @PostMapping("/upload")
    @CrossOrigin(value = {"http://localhost:8081","http://127.0.0.1:8081","http://honglitech.cn","https://honglitech.cn","http://honglitech.cn:8081","http://121.41.99.13"})
    public String upload(@RequestPart("file") MultipartFile mf);

    /**
     * 保存访问记录
     */
    @PostMapping("/visitLog")
    public String visitLog(@RequestParam("mobile") String mobile);
}
